package cn.edu.tju.core.security.service;

import cn.edu.tju.core.model.Person;
import cn.edu.tju.core.security.repository.PersonRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class PersonServiceImpl implements PersonService {

    @Autowired
    private PersonRepository personRepository;

    @Override
    @Transactional(readOnly = true) // 对于查询操作，设置为只读事务可以优化性能
    public List<Person> getAllPersons() {
        return personRepository.findAll();
    }
}
